package com.linkme2night.tests;

import java.text.SimpleDateFormat;

import junit.framework.Assert;
import android.test.AndroidTestCase;

import com.linkme2night.model.CommentDAO;


public class CommentDAOtest extends AndroidTestCase{

	CommentDAO comment_dao = new CommentDAO();
	
    public void testGetCommentsSize() throws Throwable {
    	Assert.assertEquals(1, comment_dao.getComments(1).size());
    	Assert.assertEquals(5, comment_dao.getComments(2).size());
    }
    
    public void testCommentsStrings() throws Throwable {
    	Assert.assertEquals("night2", comment_dao.getComments(1).get(0).getText());
    	
    	Assert.assertEquals("boo", comment_dao.getComments(2).get(0).getText());
    	Assert.assertEquals("poo", comment_dao.getComments(2).get(1).getText());
    	Assert.assertEquals("test2", comment_dao.getComments(2).get(2).getText());
    	Assert.assertEquals("test", comment_dao.getComments(2).get(3).getText());
    	Assert.assertEquals("night1", comment_dao.getComments(2).get(4).getText());
    }
    
    
   
    public void testCommentsDates() throws Throwable {
    	SimpleDateFormat noMilliSecondsFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    	Assert.assertEquals("2012-08-01 14:05:30", noMilliSecondsFormatter.format(comment_dao.getComments(1).get(0).getDate()));

    	Assert.assertEquals("2012-08-01 14:05:30", noMilliSecondsFormatter.format(comment_dao.getComments(2).get(0).getDate()));
    	Assert.assertEquals("2012-08-01 14:05:30", noMilliSecondsFormatter.format(comment_dao.getComments(2).get(1).getDate()));
    	Assert.assertEquals("2012-08-01 14:05:30", noMilliSecondsFormatter.format(comment_dao.getComments(2).get(2).getDate()));
    	Assert.assertEquals("2012-08-01 14:05:30", noMilliSecondsFormatter.format(comment_dao.getComments(2).get(3).getDate()));
    	Assert.assertEquals("2012-08-01 14:05:30", noMilliSecondsFormatter.format(comment_dao.getComments(2).get(4).getDate()));
    }

}
